const fs = require('fs');
let user = { username:"admin1",password:"12345" };
let str = fs.readFileSync('persons.json','utf-8');
let o =JSON.parse(str).findIndex( item => item.username === user.username && item.password === user.password);

if(o == -1){
    console.log('账号或密码错误');
}else{
    console.log('登陆成功');
}